/*
 * EmployeeAemCreationController.cpp
 *
 *  Created on: 21 ��� 2010
 *      Author: Sartios
 */

#include "EmployeeAemCreationController.h"

#include "../../../DAO/Finders/EmployeeFinders/EmployeeAemFinders/EmployeeAemDbFinder.h"
#include "../../../DAO/OdbcConnectionSingleton/OdbcConnectionSingleton.h"
#include "../../../Validators/AemValidators/TeacherAemValidators/TeacherAemValidator.h"

#include "../../../Exceptions/TeacherAemExceptions/InvalidAemExceptions/InvalidTeacherAem.h"
#include "../../../Exceptions/General/NullPointers/NullPointer.h"
#include "../../../Exceptions/DbConnectionExceptions/UnestablishedConnection.h"

EmployeeAemCreationController::EmployeeAemCreationController() {
	// TODO Auto-generated constructor stub

}

EmployeeAemCreationController::~EmployeeAemCreationController() {
	// TODO Auto-generated destructor stub
}

string	*	EmployeeAemCreationController::getNextValidAem(){

			EmployeeAemDbFinder aemFinder;
			string *aem = aemFinder.getNextValidAem();
			if((0!=aem)){
				TeacherAemValidator aemValidator;
				if(aemValidator.teacherAemIsCorrect(aem)){
					return aem;
				}throw InvalidTeacherAem("Check aem' structure");
			}throw NullPointer("Check aem finder");
}
